package sevensoft.创建型模式.工厂模式.简单工厂.factory;

import sevensoft.创建型模式.工厂模式.简单工厂.guns.impl.Ak47;
import sevensoft.创建型模式.工厂模式.简单工厂.guns.Gun;
import sevensoft.创建型模式.工厂模式.简单工厂.guns.impl.Mk18;

public class SimpleGunFactory {
    public <T extends Gun> Gun createGun(Class<T> gunClass) {
        if ( gunClass.equals(Mk18.class) )
            return new Mk18();
        if ( gunClass.equals(Ak47.class) )
            return new Ak47();
        throw new RuntimeException("undefined this gun");
    }
}
